<template>
  <div>
    <van-tabbar active-color="#f66" :route="true">
      <van-tabbar-item to="/home">
        <span>首页</span>
        <template #icon="props">
          <van-icon class-prefix="icon" name="shouye"/>
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/cate">
        <span>分类</span>
        <template #icon="props">
          <van-icon class-prefix="icon" name="leimupinleifenleileibie"/>
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/cart" :badge="items.length?items.length:''">
        <span>购物车</span>
        <template #icon="props">
          <van-icon class-prefix="icon" name="gouwuche"/>
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/user">
        <span>我的</span>
        <template #icon="props">
          <van-icon class-prefix="icon" name="wode"/>
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  computed: {
    items () {
      return this.$store.state.cart.items
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
